
import java.io.Serializable;
import java.rmi.RemoteException;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author dtuanh
 */
public class PropertyImpl implements Property, Serializable {
    //ID pour identifier la classe serializable
 private static final long serialVersionUID = 227L;
    public PropertyType type;

    public void setPropertyType(PropertyType type) {
        this.type = type;
    }

    public PropertyType getPropertyType() throws RemoteException {
        return type;
    }
    private CodeGenre genre;

    public void setGenre(CodeGenre genre) {
        this.genre = genre;
    }

    public CodeGenre getGenre() throws NotApplicableProp, RemoteException {
        return genre;
    }
    private CodeTrans trans;

    public void setTrans(CodeTrans trans) {
        this.trans = trans;
    }

    public CodeTrans getTrans() throws NotApplicableProp, RemoteException {
        return trans;
    }
    private String pluriel;

    public void setPluriel(String pluriel) {
        this.pluriel = pluriel;
    }

    public String getPluriel() throws NotApplicableProp, RemoteException {
        return pluriel;

    }
    private String feminin;

    public void setFeminin(String feminin) {
        this.feminin = feminin;
    }

    public String getFeminin() throws NotApplicableProp, RemoteException {
        return feminin;
    }
    private short groupe;

    public void setGroupe(short groupe) {
        this.groupe = groupe;
    }

    public short getGroupe() throws NotApplicableProp, RemoteException {
        return groupe;
    }

    public boolean isGenre() throws RemoteException {
        if (PropertyType.GENRE == type) {
            return true;
        }
        return false;
    }

    public boolean isPluriel() throws RemoteException {
        if (PropertyType.PLURIEL == type) {
            return true;
        }
        return false;
    }

    public boolean isFeminin() throws RemoteException {
        if (PropertyType.FEMININ == type) {
            return true;
        }
        return false;
    }

    public boolean isGroupe() throws RemoteException {
        if (PropertyType.GROUPE == type) {
            return true;
        }
        return false;
    }

    public boolean isTransitive() throws RemoteException {
        if (PropertyType.TRANSIVITE == type) {
            return true;
        }
        return false;
    }

    public String printString() throws RemoteException {
        switch (type) {
            case GENRE:
                if (genre == CodeGenre.MASC) {
                    return "MASC";
                }
                if (genre == CodeGenre.FEM) {
                    return "FEM";
                }
            case PLURIEL:
                return this.pluriel;
            case FEMININ:
                return feminin;
            case GROUPE:
                return groupe + "";
            case TRANSIVITE:
                if (CodeTrans.INTR == trans) {
                    return "INTR";
                }
                if (CodeTrans.TRANS == trans) {
                    return "TRANS";
                }
        }
        return null;
    }

    public String toFile() throws RemoteException {
        switch (type) {
            case GENRE:
                if (genre == CodeGenre.MASC) {
                    return "MASC";
                }
                if (genre == CodeGenre.FEM) {
                    return "FEM";
                }
            case PLURIEL:
                return "«"+this.pluriel+"»";
            case FEMININ:
                return  "«"+feminin+"»";
            case GROUPE:
                return groupe + "";
            case TRANSIVITE:
                if (CodeTrans.INTR == trans) {
                    return "INTR";
                }
                if (CodeTrans.TRANS == trans) {
                    return "TRANS";
                }
        }
        return null;
    }
}
